let cart = [
  { name: "iphone", price: 12000 },
  { name: "imac", price: 18000 },
  { name: "ipad", price: 3200 }
];
//负数，从小到大；正数，就从大到小
cart = cart.sort(function(a, b) {
  return b.price - a.price;
});
console.table(cart);
